package com.changyinBus.web.controller.system;

import com.changyinBus.common.core.controller.BaseController;
import com.changyinBus.common.core.domain.AjaxResult;
import com.changyinBus.common.core.domain.entity.SysMessage;
import com.changyinBus.common.core.page.TableDataInfo;
import com.changyinBus.system.service.ISysMessageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/system/message")
public class SysMessageController  extends BaseController {
    @Resource
    private ISysMessageService sysMessageService;

    /**
     * 获取列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SysMessage message) {
        startPage();
        List<SysMessage> list = sysMessageService.selectMessageList(message);
        return getDataTable(list);
    }

    @GetMapping(value = { "/", "/{messageId}" })
    public AjaxResult getInfo(@PathVariable(value = "messageId", required = false) Long messageId) {
        return success(sysMessageService.selectMessageById(messageId));
    }
}
